/* util */
import http from '@src/util/http'
/* model */
import MsgModel from '@model/MsgModel'
import { 
  BaseSelectUserGetDepartmentListModel, 
  BaseSelectUserGetDepartmentListResult, 
  BaseSelectUserGetMarkListResult, 
  BaseSelectUserGetRoleListResult, 
  BaseSelectUserGetServiceProviderListResult, 
  BaseSelectUserGetServiceProviderQualificationListResult, 
  BaseSelectUserGetStateListResult,
  BaseSelectUserGetSearchUserListModel,
  BaseSelectUserGetRoleUserListModel,
  BaseSelectUserGetRoleUserListResult,
  BaseSelectUserGetServiceProviderUserListModel,
  BaseSelectUserGetServiceProviderUserListResult,
  BaseSelectUserGetSearchUserListResult,
  BaseSelectUserGetServiceProviderTypeListResult,
  BaseSelectUserGetDepartmentUserListResult,
  BaseSelectUserGetDepartmentUserListModel,
  BaseSelectUserGetRoleListModel,
  BaseSelectUserGetServiceProviderListModel,
  BaseSelectUserGetMarkListModel,
  BaseSelectUserGetSearchMoreUserListModel,
  BaseSelectUserGetSearchMoreUserListResult
} from '@src/component/common/BaseSelectUser/types'
import { SelectUserComponentUser } from '@src/component/common/BaseSelectUser/model'

/**
 * @description 获取选人控件的查询标签
 * @see http://yapi.shb.ltd/project/307/interface/api/35280
 */
export function getSelectUserMarkList(params: BaseSelectUserGetMarkListModel): Promise<MsgModel<BaseSelectUserGetMarkListResult>> {
  return http.get('/api/user/outside/select/getMarkList', params)
}

/**
 * @description 获取选人控件的部门列表
 * @see http://yapi.shb.ltd/project/307/interface/api/35298
 */
export function getSelectUserDepartmentList(params: BaseSelectUserGetDepartmentListModel): Promise<MsgModel<BaseSelectUserGetDepartmentListResult>> {
  return http.post('/api/user/outside/select/getTagList', params)
}

/**
 * @description 获取选人控件的用户状态列表
 * @see http://yapi.shb.ltd/project/307/interface/api/35274
 */
export function getSelectUserStateList(): Promise<MsgModel<BaseSelectUserGetStateListResult>> {
  return http.get('/api/user/outside/select/getUserStateList')
}

/**
 * @description 获取选人控件的人员标签列表
 * @see http://yapi.shb.ltd/project/307/interface/api/35286
 */
export function getSelectUserLabelList(): Promise<MsgModel<BaseSelectUserGetStateListResult>> {
  return http.get('/api/user/outside/select/getLabelList')
}

/**
 * @description 获取选人控件 全局搜索后的 用户列表
 * @see http://yapi.shb.ltd/project/307/interface/api/35316
 */
export function getSelectSearchUserList(params: BaseSelectUserGetSearchUserListModel): Promise<MsgModel<BaseSelectUserGetSearchUserListResult>> {
  return http.post('/api/user/outside/select/getUserList', params)
}

/**
 * @description 获取选人控件 角色 用户列表
 * @see http://yapi.shb.ltd/project/307/interface/api/35406
 */
export function getSelectRoleUserList(params: BaseSelectUserGetRoleUserListModel): Promise<MsgModel<BaseSelectUserGetRoleUserListResult>> {
  return http.post('/api/user/outside/select/getUserFromRole', params)
}

/**
 * @description 获取选人控件的角色列表
 * @see http://yapi.shb.ltd/project/307/interface/api/35304
 */
export function getSelectRoleList(params: BaseSelectUserGetRoleListModel): Promise<MsgModel<BaseSelectUserGetRoleListResult>> {
  return http.post('/api/user/outside/select/getRoleList', params)
}

/**
 * @description 获取选人控件的服务商列表
 * @see http://yapi.shb.ltd/project/307/interface/api/35310
 */
export function getSelectServiceProviderList(params: BaseSelectUserGetServiceProviderListModel): Promise<MsgModel<BaseSelectUserGetServiceProviderListResult>> {
  // return http.post('/api/user/outside/select/getSpList', params)
  return http.post('/pc/biz/select/spList', params)
}

/**
 * @description 获取选人控件 服务商 用户列表
 * @see http://yapi.shb.ltd/project/307/interface/api/35412
 */
export function getSelectServiceProviderUserList(params: BaseSelectUserGetServiceProviderUserListModel): Promise<MsgModel<BaseSelectUserGetServiceProviderUserListResult>> {
  return http.post('/api/user/outside/select/getUserFromSp', params)
}

/**
 * @description 获取选人控件的服务商资质列表
 * @see http://yapi.shb.ltd/project/307/interface/api/35292
 */
export function getSelectServiceProviderQualificationList(): Promise<MsgModel<BaseSelectUserGetServiceProviderQualificationListResult>> {
  return http.get('/api/user/outside/select/getSpQualificationList')
}

/**
 * @description 获取选人控件的服务商类型列表
 * @see http://yapi.shb.ltd/project/307/interface/api/35394
 */
export function getSelectServiceProviderTypeList(): Promise<MsgModel<BaseSelectUserGetServiceProviderTypeListResult>> {
  return http.get('/api/user/outside/select/getSpTypeList')
}

/**
 * @description 获取选人控件 点击部门查询 子部门、用户列表
 * @see http://yapi.shb.ltd/project/307/interface/api/35400
 */
export function getSelectDepartmentUserList(params: BaseSelectUserGetDepartmentUserListModel): Promise<MsgModel<BaseSelectUserGetDepartmentUserListResult>> {
  return http.post('/api/user/outside/select/getUserFromTag', params)
}

/**
 * @description 获取选人控件 日程管理 - 新建日程 -选择参与人 部门查询列表
 * @see http://yapi.shb.ltd/project/307/interface/api/35544
 */
export function getSelectDepartmentCalendarUserList(params: BaseSelectUserGetDepartmentListModel): Promise<MsgModel<BaseSelectUserGetDepartmentListResult>> {
  return http.post('/calendar/add/user/tree/v2', params)
}

/**
 * @description 获取选人控件 搜索人员列表 查看更多人员列表
 * @see http://yapi.shb.ltd/project/307/interface/api/35568
 */
export function getSelectSearchMoreUserList(params: BaseSelectUserGetSearchMoreUserListModel): Promise<MsgModel<BaseSelectUserGetSearchMoreUserListResult>> {
  return http.post('/api/user/outside/select//getUserFromMore', params)
}

/**
 * @description 获取选人控件 根据用户 id 获取用户
 * @see http://yapi.shb.ltd/project/307/interface/api/35580
 */
export function getSelectGetUserByIdList(params: string[]): Promise<MsgModel<SelectUserComponentUser[]>> {
  return http.post('/api/user/outside/select/getUserByIdList', params)
}

export default {
  getSelectUserMarkList,
  getSelectUserDepartmentList,
  getSelectUserStateList,
  getSelectUserLabelList,
  getSelectSearchUserList,
  getSelectRoleList,
  getSelectServiceProviderList,
  getSelectServiceProviderQualificationList,
  getSelectRoleUserList,
  getSelectServiceProviderUserList,
  getSelectServiceProviderTypeList,
  getSelectDepartmentUserList,
  getSelectDepartmentCalendarUserList,
  getSelectSearchMoreUserList,
  getSelectGetUserByIdList
}
